begintownscript;

variables;
short bmessage,pcs,seated,leadchar,rctx,rcty,sdf_counter;
string custom_m;

body;

beginstate INIT_STATE;

	turn_off_training(1);
	set_crime_tolerance(5);

break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;

	if(get_crime_level() > 0){
		message_dialog("There are not many soldiers in Thermidor compared to how many are outside of it, but there are still many soldiers in Thermidor compared to me.  A trial by my peers is foregone in favor of an on-site execution.","");
		kill_char(1000,3,0);
	}

break;

beginstate 10;

	message_dialog("I doubt that I would want to return to this level.  All of these strange and new things appear to be drawing me down here.","");
	block_entry(1);

break;

beginstate 11;

	if(get_flag(1,0) < 20){
		reset_dialog();
		add_dialog_str(0,"_Captain Maverick...  good.  We are friends.  With this said:  We need someone of your rank to convince the people here to let us take their best equipment._",15);
		add_dialog_str(1,"_You can command them to do this and they will give in.  We cannot.  Do this for us, and we will continue to be friends._",0);
		add_dialog_str(2,"_You have many questions.  We will not answer them now.  It would take too much time.  Go.  We will, as always, be watching.  Thank you, Captain Maverick.  Thank yourself too.  You're doing everyone a favor._",15);
		add_dialog_str(3,"It is probably not worth my time to ask him anything.  Before I am even able to consider doing so, he ducks into the shadows and is gone.",0);
		add_dialog_choice(0,"...");
		bmessage = run_dialog(1);
		set_flag(1,0,20);
		erase_char(6);
	}

break;

beginstate 12;

	if(get_flag(1,0) < 26){
		message_dialog("This leads to the rear entrance to the Command Center.  There is nothing here but a gatehouse and three strong, sturdy gates that will hopefully hold out.","");
		block_entry(1);
		end();
	}

break;

beginstate 13;

	if(get_flag(1,0) < 21){
		message_dialog("This is odd.  I am helping people who are likely traitors.  I should not be doing this morally, but if my morals have placed me into Thermidor, a deathdrap, then I will help them.","They appear competent.  I will do this.");
		set_flag(1,0,21);
	}

break;

beginstate 14;

	if(get_flag(1,0) < 22){
		message_dialog("One quick look at the storehouse here shows the great wonders Thermidor is capable of producing:  Gleaming steel which glitters in the torchlight.  It is worth many thousands of gold pieces in total.","My newfound friends want this steel.  Very well; if they offer me survival, they may have it.  I have nothing to lose.");
		set_flag(1,0,22);
	}

break;

beginstate 15;

	if(get_flag(4,0) < 1){
		message_dialog("This forge is being used to repair shattered weaponry.  The blacksmiths have mostly died or have run out of solid ingots to process into new weapons, but with rudimentary training, it is still possible to repair broken blades and spears.","They are not likely to produce anything of great worth, but if they can salvage any of the equipment, it is to Thermidor's advantage.");
		set_flag(4,0,1);
	}

break;

beginstate 16;

	if(get_flag(1,0) < 23){
		message_dialog("Alright.  I must now tell the well-armed and nervous soldiers here to let me into the supply stores without sounding suspicious.","");
		march_party(19,31);
		force_view_center(19,31);
		force_instant_terrain_redraw();
		play_sound(50);
		pause(2);

		march_party(20,31);
		force_view_center(20,31);
		force_instant_terrain_redraw();
		play_sound(49);
		pause(2);

		set_character_facing(1000,0);
		force_instant_terrain_redraw();
		pause(2);

		reset_dialog();
		add_dialog_str(0,"_H-hello, sir...  how odd to see you.  How may I be of service?_",15);
		add_dialog_str(1,"Okay, now ask him cooly and naturally...  Let it flow.  Okay.  I've got this.",0);
		add_dialog_choice(0,"I'd like to enter the storeroom here.");
		bmessage = run_dialog(1);

		play_sound(99);
		pause(3);

		reset_dialog();
		add_dialog_str(0,"_There you go, sir.  Will that be all?_",15);
		add_dialog_str(1,"See?  There was not any reason to be nervous.  I am fine.",0);
		add_dialog_choice(0,"No, that will be all, thank you.");

		set_terrain(21,18,32);
		set_terrain(22,18,32);
		set_terrain(23,18,32);
		rctx = 26;
		while(rctx <= 34){
			move_item_on_spot(rctx,20,-1,-1);
			move_item_on_spot(rctx,21,-1,-1);
			move_item_on_spot(rctx,22,-1,-1);
			move_item_on_spot(rctx,23,-1,-1);
			move_item_on_spot(rctx,24,-1,-1);

			rctx = (rctx + 2);
		}

		set_flag(1,0,23);
		block_entry(1);
	}

break;

beginstate 17;

	if(get_flag(1,0) == 23){
		message_dialog("My new friends work quickly.  They've already ransacked the storeroom.","They are very ambitious, and I still do not know what it is that they want.  This is all very peculiar.");
		set_flag(1,0,24);
	}

break;

beginstate 18;

	if(get_flag(1,0) == 24){
		message_dialog("On the cusp of audibility, a few odd noises can be heard.","It sounds ominous, given how quiet things normally are here.  In fact, given how odd things around here are, it just might be fighting.  This warrants being alarmed.");
		activate_hidden_group(1);
		set_flag(1,0,25);
	}

break;

beginstate 19;

	if(get_flag(1,0) == 25){
		reset_dialog();
		add_dialog_str(0,"All of these things are very odd.  The oddest thing of all is that this soldier's gleaming, steel sword and armor are dripping with blood.  My suspicions were correct.",0);
		add_dialog_str(1,"How did things end up this way?  Then again, he would probably tell me that it is my competence or something equally as obscure.  He does not want me to know much yet.",0);
		add_dialog_str(2,"Was I moral?  No, probably not.  I do not care.  I am promised my life.  They can use me in exchange for that, as they have.",0);
		add_dialog_str(3,"_Captain Maverick!  Why are you just standing there?  We must leave quickly.  Lieutenant Fogram wishes to thank you in person._",15);
		add_dialog_str(4,"This is making sense now...  a foreign army...  The soldier quickly sneaks down the hall.",0);
		add_dialog_choice(0,"...");
		bmessage = run_dialog(1);

		erase_char(20);

		set_flag(1,0,26);
	}

break;

beginstate 20;

	if(get_flag(5,0) == 0){
		message_dialog("The gate mechanism here has been smashed.  Thermidor is doomed.","");
		set_flag(5,0,1);
	}

break;

beginstate 21;

	if(get_flag(1,0) < 27){
		message_dialog("There was a battle here.  The defenders, however, clearly weren't ready.  It appears as if my newfound allies took the day.  It is strange how quickly all of this appeared to be moving.","");
		set_flag(1,0,27);
	}

break;

beginstate 22;

	if(get_flag(1,0) < 28){
		message_dialog("The gates ahead are open.  Now it is time to see what my reward is.","");
		set_flag(1,0,28);
	}

break;

beginstate 23;

	reset_dialog();
	add_dialog_str(0,"There is a collection of people here.  Some where the purple of Lord Ameron, most of which is made out of new, sparkling steel.  The other suits of armor bear the emblem of Lord Rosham.  The one thing uniting them all, though, is their anxiety.",0);
	add_dialog_str(1,"_Good.  Captain Maverick...  I am Lieutenant Fogram.  I come from Lord Rosham, wishing you his best._",15);
	add_dialog_str(2,"His speech is halting, but otherwise good.  Those from Rosham's domain speak the same language as those from my homeland, but they have a slightly different method of pronounciation.",0);
	add_dialog_str(3,"_Your friends have nominated you to lead the Bonus Army.  I am glad that you volunteered.  They tell me you know little, but that is okay.  You are now spared the inevitable demise of Thermidor._",15);
	add_dialog_str(4,"_We will fill you in as things go on, but no matter how confused you are now about all things, if you were stuck in that deathtrap before, you are undoubtedly more knowledgeable now._",15);
	add_dialog_str(5,"_You will always be swept up in things, but you are lucky.  The greater tide has caught you.  Welcome, friend._",30);
	bmessage = run_dialog(1);
	end_scenario(2);

break;

